package com.kanavi.dataAccess.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.common.boot.common.CommonResult;
import com.kanavi.dataAccess.config.ApiAuthContextHolder;
import com.kanavi.dataAccess.config.ListApiAuthParamsParser;
import com.kanavi.dataAccess.config.anno.ApiAuth;
import com.kanavi.dataAccess.entity.NucleicAcidRuleConfig;
import com.kanavi.dataAccess.mapper.NucleicAcidRuleConfigMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping
@RequiredArgsConstructor
public class TestC {

    private final NucleicAcidRuleConfigMapper nucleicAcidRuleConfigMapper;

    @GetMapping("/list")
    public CommonResult list() {
        return CommonResult.success(nucleicAcidRuleConfigMapper.selectList(null));
    }

    @GetMapping("/test")
    @ApiAuth(paramsParser = ListApiAuthParamsParser.class)
    public List test() {
        Map<String, Object> params = new HashMap<>();
        List<String> list1 = new ArrayList<>();
        list1.add("唐海岚");
        params.put("list", list1);
        ApiAuthContextHolder.setParams(params);
        QueryWrapper<NucleicAcidRuleConfig> configQueryWrapper = new QueryWrapper<>();
        List<NucleicAcidRuleConfig> list = nucleicAcidRuleConfigMapper.selectList(configQueryWrapper);
        return list;
    }

}
